package ua.mykola.graph;

import java.util.Comparator;

/**
 * Compares labels of vertices on the other side.
 * 
 */
public final class OtherSideLabelComparator implements Comparator<Edge> {
	private final Vertex vertex1;

	OtherSideLabelComparator(Vertex vertex1) {
		this.vertex1 = vertex1;
	}

	@Override
	public int compare(Edge o1, Edge o2) {
		return o1.getOtherSide(vertex1).getLabel()
				.compareTo(o2.getOtherSide(vertex1).getLabel());
	}
}